home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 1996 #6 / Amiga Plus CD - 1996 - No. 06.iso / pd / tools / frexxed / fpl / emode.fpl < prev    next >
Text File  |  1996-03-18  |  3KB  |  114 lines

  1. // $Id: EMode.FPL 1.2 1996/03/18 19:53:39 dapp Exp dapp $
  2. // $VER: frexxed:Startup/EMode.FPL 0.12 (18.03.96) $
  3.  
  4. string stripExtension(string file)
  5. {
  6.   int len=strlen(file);
  7.   for(--len;len>0 && file[len]!='.'; --len);
  8.   if(!len)
  9.     return(file);
  10.   return(substr(file,0,len));
  11. }
  12.  
  13. export void AmigaEPrefs()
  14. {
  15.   PromptInfo(-1,"EMode preferences",-1,-1,
  16.     "AmigaE_bin_dir",
  17.     "AmigaE_temp_dir",
  18.     "AmigaE_options",
  19.     "AmigaE_output"
  20.     );
  21. }
  22.  
  23. export void AmigaE_Compile(void)
  24. {
  25.   string com,reqtext;
  26.   int result,reqresult;
  27.  
  28.   // SaveChanges();
  29.   Status(0,sprintf("Compiling %s ...", ReadInfo("file_name")));
  30.  
  31.   com+=ReadInfo("AmigaE_bin_dir",GetBufferID());
  32.   com+="ec >";
  33.   com+=ReadInfo("AmigaE_temp_dir",GetBufferID());
  34.   com+=" ERRBYTE ";
  35.   com+=ReadInfo("AmigaE_options",GetBufferID());
  36.   com+=" SOURCE ";
  37.   com+=ReadInfo("file_path",GetBufferID());
  38.   com+=ReadInfo("file_name",GetBufferID());
  39.   result=System(com);
  40.  
  41.   if (result>0) {
  42.     reqtext+="Type >";
  43.     reqtext+=ReadInfo("AmigaE_output",GetBufferID());
  44.     com+="/SCREEN";
  45.     reqtext+=ReadInfo("current_screen",GetBufferID());
  46.     reqtext+=" ";
  47.     reqtext+=ReadInfo("AmigaE_temp_dir",GetBufferID());
  48.     reqresult=Request("Jump to Error?","AmigaE","Jump|Stay");
  49.     if (reqresult==1) {
  50.       Visible(0);
  51.       Top();
  52.       CursorRight(result);
  53.       Visible(1);
  54.     }
  55.     System(reqtext);
  56.   }
  57.   else {
  58.     ReturnStatus(sprintf("Compiling %s ... Succesful", ReadInfo("file_name")));
  59.   }
  60. }
  61.  
  62. export void AmigaE_Run(int args)
  63. {
  64.   int len;
  65.   string file,com;
  66.  
  67.   com="C:Run ";
  68.   com+=ReadInfo("file_path",GetBufferID());
  69.  
  70.   file=ReadInfo("file_name",GetBufferID());
  71.  
  72.   if(!(len=strlen(file)))
  73.     return;
  74.  
  75.   com+=stripExtension(file);
  76.   com+=" >";
  77.   com+=ReadInfo("AmigaE_output",GetBufferID());
  78.   com+="/SCREEN";
  79.   com+=ReadInfo("current_screen",GetBufferID());
  80.   if(args==1) {
  81.     com+=" ";
  82.     com+=PromptString("","Program execution","Enter arguments");
  83.   }
  84.   System(com);
  85. }
  86.  
  87. export void emodeinit()
  88. {
  89.  int face = FaceGet("e-mode", 1); /* fetch e-face if not already loaded */
  90.  if(face) {
  91.    ExecuteFile("EFace.FPL");
  92.  }
  93.  SetInfo(-1,"face","e-mode");
  94. }
  95.  
  96. //»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»» EMode settings ««
  97. ConstructInfo("e_mode", "","", "LBH","", 0,0,0);
  98. ConstructInfo("e_mode_ext", "","", "GSHW","", 0,0,"*e*");
  99. ConstructInfo("e_mode_exe", "","", "GSHW","", 0,0,"emodeinit();");
  100.  
  101. ConstructInfo("AmigaE_bin_dir","","","WHGS","",0,0,"e:bin/");
  102. ConstructInfo("AmigaE_temp_dir","","","WHGS","",0,0,"t:e.temp");
  103. ConstructInfo("AmigaE_options","","","WHGS","",0,0,"REG=5");
  104. ConstructInfo("AmigaE_output","","","WHGS","",0,0,"CON:0/0/610/80/E output/CLOSE/WAIT");
  105.  
  106. AddMode(1, "e_mode", "e_mode_ext", "e_mode_exe");
  107.  
  108. MenuAdd("t", "Amiga E");
  109.     MenuAdd("i", "Compile","AmigaE_Compile();","");
  110.     MenuAdd("i", "Run",    "AmigaE_Run(0);",    "");
  111.     MenuAdd("i", "RunArg", "AmigaE_Run(1);", "");
  112. MenuAdd("s", "EMode...", "AmigaEPrefs();", "", 6,6,-1); // Add to PackageSettings
  113. MenuBuild();
  114.